package com.pure
{
	import com.pure.controller.DelUserCommand;
	import com.pure.controller.SaveUserCommand;
	import com.pure.controller.StartUpCommand;
	
	import org.puremvc.as3.patterns.facade.Facade;

	public class ApplicationFacade extends Facade
	{
		/**
		 * Singleton Factory Method
		 */
		public static function getInstance() : ApplicationFacade {
			// The instance(variable) is declare in lib of pureMvc
			if ( instance == null ) instance = new ApplicationFacade( );
			return ApplicationFacade( instance ) ;
		}
		
		/**
		 * Start the application
		 */
		 public function startup( app:MyApp ):void
		 {
		 	sendNotification( CMD_STARTUP, app );	
		 }
		 
		/**
		 * Register Commands with the Controller 
		 */
		override protected function initializeController( ) : void 
		{
			super.initializeController();			
			registerCommand( CMD_STARTUP, StartUpCommand );
			// register more commands below
			registerCommand( CMD_SAVE_USER, SaveUserCommand );
			registerCommand( CMD_DEL_USER, DelUserCommand );
		}
		 
		/**
		 *  Notification name constants
		 */
		public static const CMD_STARTUP:String = "cmd_startup";
		public static const CMD_SAVE_USER:String = "cmd_save_user";
		public static const CMD_DEL_USER:String = "cmd_del_user";
		
		public static const EDIT_USER:String = "edit_user";
		public static const SAVE_USER:String = "save_user";
		public static const CREATE_USER:String = "create_user";
	}
}